﻿<%@ Page Language="C#" MasterPageFile="~/admin/admin.master" AutoEventWireup="true" CodeFile="adduser.aspx.cs" Inherits="admin_user_adduser" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <link href="../stylesheet/admin.css" rel="stylesheet" type="text/css" />
    <script src="../script/jquery-1.3.2.js" type="text/javascript"></script>
    <script src="../script/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        $(document).ready(function() {
        $("#resultbox").hide();
        
            $('.inputform1 input').click(function() {
                $(this).parent("td").parent("tr").css("background-color", "#dbe8f9");
            });
            $('.inputform1 input').blur(function() {
                $(this).parent("td").parent("tr").css("background-color", "#ffffff");
            });

            $('#SaveUser').click(function() {
            var User = "{'UserName':'" + $('#username').val() + "','Password':'" + $('#password').val() + "','FirstName':'" + $('#firstname').val() + "','LastName':'" + $('#lastname').val() + "','Email':'" + $('#email').val() + "'}";
            $('#resultimg').attr('src', "../stylesheet/images/loader.gif");
            $('#resulttxt').text(" Processing ...");
            $('#resultbox').show();
            PageMethod('saveUser', ['user', User], OnSucceeded, OnFailed);
           });
        });
       
        function OnSucceeded(result, context, method) {
            if (result.d == 1) {
                $('#resultimg').attr('src', "../stylesheet/images/ok.png");
                $('#resulttxt').text(" User Saved Successfully");
                $('#resultbox').show();
            }
            else if (result.d == 0) {
            $('#resultimg').attr('src', "../stylesheet/images/cancel.png");
            $('#resulttxt').text(" User Could Not Be Saved");
            $('#resultbox').show();
            }
            else {
                $('#resultimg').attr('src', "../stylesheet/images/error.png");
                $('#resulttxt').text(" Error in Operation");
                $('#resultbox').show();
            }
        }

        function OnFailed(result, context, method) {
            $('#resultimg').attr('src', "../stylesheet/images/error.png");
            $('#resulttxt').text(" System Error in Operation");
            $('#resultbox').show();
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<br/>
<div class="pad20left pad20right"><div id="pagebar"><span class="pad20left bigwhitebold">Add a New User</span></div></div>
<br/>
<div class="inputform1">
<table cellspacing="0" class="inputtable1">
<tr><td class="bigboldbluetext" colspan="3">Login Details</td></tr>
<tr ><td>Username</td><td>:</td><td id="new"><input type="text" id="username" /></td></tr>
<tr><td>Password</td><td>:</td><td><input type="text" id="password" /></td></tr>
<tr><td class="bigboldbluetext" colspan="3">Contact Details</td></tr>
<tr><td>Email</td><td>:</td><td><input type="text" id="email" /></td></tr>
<tr><td class="bigboldbluetext" colspan="3">User Details</td></tr>
<tr><td>First Name</td><td>:</td><td><input type="text" id="firstname" /></td></tr>
<tr><td>Last Name</td><td>:</td><td><input type="text" id="lastname" /></td></tr>
<tr><td></td><td></td><td><div class="buttons"><a id="SaveUser"  href="#" >Save</a><a href="../dashboard.aspx" >Cancel</a></div></td></tr>
<tr><td></td><td></td><td><div id="resultbox"><img id="resultimg" src="" /> <label id="resulttxt"  ></label></div></td></tr>

</table>
</div>
</asp:Content>

